package com.dididoctor.doctor.Activity.PatientDetial;

import android.view.KeyEvent;
import android.view.View;
import android.widget.TextView;

import com.dididoctor.doctor.MV.EduActivity;
import com.dididoctor.doctor.R;
import com.dididoctor.doctor.Utils.Util;

/**
 * Created by boy on 2016/4/21.
 */
public class PersonalDataActivit extends EduActivity implements PersonalDataView {
    private TextView mTvName, mTvSex, mTvAge, mEtJob, mEtAgfood, mEtAgpill;
    private PersonalDataPresenter presenter;
    private String clientId, status, isSign;

    @Override
    public void setContentLayout() {
        setContentView(R.layout.activity_personaldata);
        clientId = getIntent().getStringExtra("clientId");
        status = getIntent().getStringExtra("status");

        isSign = getIntent().getStringExtra("isSign");
    }

    @Override
    public void init() {


        mTvName = (TextView) findViewById(R.id.tv_name);
        mTvSex = (TextView) findViewById(R.id.tv_sex);
        mTvAge = (TextView) findViewById(R.id.tv_age);
        mEtJob = (TextView) findViewById(R.id.et_job);
        mEtAgfood = (TextView) findViewById(R.id.et_agfood);
        mEtAgpill = (TextView) findViewById(R.id.et_agpill);

        presenter = new PersonalDataPresenter(this, this);
        presenter.Lunch(clientId);
    }

    @Override
    public void onClickEvent(View view) {

    }


    @Override
    public void getdoctorfail() {

    }

    @Override
    public void getdoctorsucced(PersonalDataBean PersonalData) {
        mTvName.setText(PersonalData.getName().toString().trim());
        if ("0".equals(PersonalData.getSex().toString().trim())) {
            mTvSex.setText("女");
        } else {
            mTvSex.setText("男");
        }
//        "sex": "0",
//                "age": 35,
//                "name": "188****7777",
//                "allergicFood": "没有",
//                "allergicPill": "没有",
//                "job": "泡脚",
//                "headPic": "http://app2.doudoutech.com/upload/clientHeadPic/125/1462181523876ahb_20160501_125710.jpg"
        mTvAge.setText(Util.isEmpty(PersonalData.getAge()) ? "" : PersonalData.getAge());
        mEtJob.setText(Util.isEmpty(PersonalData.getJob()) ? "" : PersonalData.getJob());
        mEtAgfood.setText(Util.isEmpty(PersonalData.getAllergicFood()) ? "" : PersonalData.getAllergicFood());
        mEtAgpill.setText(Util.isEmpty(PersonalData.getAllergicPill()) ? "" : PersonalData.getAllergicPill());
    }

    @Override
    public boolean onKeyUp(int keyCode, KeyEvent event) {
        return false;
    }

}
